package com.ujiuy.springsessiondemo.demo;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@Controller
public class Session1 {
    @GetMapping("/set")
    public String set(HttpSession session){
        session.setAttribute("set","测试springSession");
        return "ok";
    }

    @GetMapping("/get")
    public String get(HttpSession session){
         return (String)session.getAttribute("set");
    }
}
